package cate.game.power;

import cate.common.table.throne.sacrifice.KingSacrificeLevelRow;
import cate.game.attr.FightAttr;
import cate.game.attr.PowerAttrPart;
import cate.game.role.Role;
import cate.game.role.res.kingsacrifice.KingSacrificeJobInfo;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

import java.util.HashMap;
import java.util.Map;

@NoteClass("灵王祭祀")
public class KingSacrificePowerFactor extends PowerAttrPart {

	@NoteField(value = "职业属性",detail = "")
	private Map<Byte,FightAttr> jobAttrMap = new HashMap<>();

	public KingSacrificePowerFactor(Role role) {
		for (KingSacrificeJobInfo value : role.getRes().kingSacrifice.jobs.values()) {
			if (value.level > 0) {
				KingSacrificeLevelRow row = role.getGame().table.kingSacrifice.level.findRow(value.job, value.level);
				if (row != null) {
					jobAttrMap.put(value.job, new FightAttr(row.attrStr));
				}
			}
		}
	}

	public PowerAttrPart buildHeroPart(byte job) {
		PowerAttrPart part = new PowerAttrPart();
		if (jobAttrMap.containsKey(job)) {
			part.attr.add(jobAttrMap.get(job));
		}
		return part;
	}
}
